package com.dongjiantong.web.protal.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongjiantong.biz.enums.DrugStoreType;
import com.dongjiantong.biz.model.DrugStore;
import com.dongjiantong.biz.service.DrugStoreService;
import com.dongjiantong.common.exceptions.HttpCode;
import com.dongjiantong.common.exceptions.OPServerException;
import com.dongjiantong.common.model.Response;
import com.dongjiantong.openplatform.annotations.OpenBean;
import com.dongjiantong.openplatform.annotations.OpenMethod;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;
import java.util.Map;

/**
 * @author Lee
 * @date 2018/1/9
 */
@Slf4j
@OpenBean
public class DrugStoreController {
    @Reference(version = "1.0.0")
    public DrugStoreService drugStoreService;

    /**
     * 养殖档案获取药物种类,养殖档案获取疫苗种类
     * @return
     */
    @OpenMethod(key = "app.biz.obtainVaccineOrDrug",
            paramNames = {"type","name","pageNum","pageSize"},
            httpMethods = RequestMethod.GET)
    public Response<PageInfo<Map<String,Object>>> obtainVaccine(Integer type,
                                                            String name,
                                                            Integer pageNum,
                                                            Integer pageSize){
        PageInfo<Map<String,Object>> pageInfo = drugStoreService.getDrugStore(type,name,pageNum,pageSize);
        return Response.ok(pageInfo);
    }
}
